package com.eatsystem.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.eatsystem.entity.User;
import com.eatsystem.mapper.UserMapper;
import com.eatsystem.service.UserService;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;

@Service
public class UserMapperImpl extends ServiceImpl<UserMapper, User> implements UserService {

    //将用户保存到数据库
    @Override
    public void saveUser(User user) {
        String MD5pwd = user.getPassword();
        user.setPassword(DigestUtils.md5DigestAsHex(MD5pwd.getBytes()));
        this.save(user);
    }


}
